package com.jun;
import com.vdp.utils.JdbcUtils;

import java.sql.*;

public class TestJdbc03 {
    public static void main(String[] args) {
        Connection conn=null;
        PreparedStatement ps =null;
        ResultSet rs = null;
        try {
            conn=JdbcUtils.getConnection();
            String sql="insert into users(id,name,password,email,birthday)values(?,?,?,?,?)";
            ps=conn.prepareStatement(sql);
            // 要set就得全部给
            ps.setInt(1,7);
            ps.setString(2,"王niannian");
            ps.setString(3,"666666");
            ps.setString(4,"vdp@pornhub.123");
            ps.setDate(5,new Date(new java.util.Date().getTime()));
            int num=ps.executeUpdate();
            if(num>0) System.out.println("修改成功！");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally{
            JdbcUtils.release(conn, ps, rs);
        }
    }
}

